package tech.wetech.admin3.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tech.wetech.admin3.dtos.NotifyDto;
import tech.wetech.admin3.sys.service.NativePayService;
import java.io.IOException;
import java.util.Map;

@RestController
@RequestMapping("/wxpay/native")
public class WxNativePayController {
  @Autowired
  private NativePayService nativePayService;

  @PostMapping("/create_order")
  public Map<String, String> createOrder(@RequestParam("out_trade_no") String out_trade_no) throws IOException {
    return nativePayService.createOrder(out_trade_no);
  }

  @GetMapping("/query_order")
  public Map<String, String> queryOrder(@RequestParam String out_trade_no) throws IOException {
    return nativePayService.queryOrder(out_trade_no);
  }

  @PostMapping("/notify")
  public Map<String, String> payNotify(@RequestBody NotifyDto dto) {


    return nativePayService.payNotify(dto);
  }
}
